import { createRouter, createWebHistory } from 'vue-router';
import routerURL from './routerURL';

const routes = [
    // 主页 路由
    {
        path: routerURL.HOME,
        name: 'Home',//主页
        component: () => import('@/views/Home/HomeView.vue'),
    },
    {
        path: routerURL.PRODUCT_INFO,
        name: 'ProductInfo',//商品信息
        component: () => import('@/views/Home/ProductInfo.vue'),
        meta: { hideFooter: true },
    },
    {
        path: routerURL.PRODUCT_TAGE,
        name: 'ProductTage',//商品分类
        component: () => import('@/views/Home/ProductTage.vue'),
        meta: { hideFooter: true },
    },
    {
        path: routerURL.SEARCHPAGE,
        name: 'Searchpage',//搜索页面
        component: () => import('@/views/Home/SearchPage.vue'),
        meta: { hideFooter: true },
    },

    // 我的 路由
    {
        path: routerURL.MINE,
        name: 'Mine',
        component: () => import('@/views/Mine/MineView.vue'),
    },
    //我发布的商品 路由
    {
        path: routerURL.MY_PRODUCTS,
        name: 'Myproducts',
        component: () => import('@/views/Mine/MyProducts.vue'),
        meta: { hideFooter: true },
    },
    //已失效的商品 路由
    {
        path: routerURL.FAILURE,
        name: 'Failure',
        component: () => import('@/views/Mine/FailureProduct.vue'),
        meta: { hideFooter: true }
    },
    //地址管理 路由
    {
        path: routerURL.MY_ADDRESS,
        name: 'Address',
        component: () => import('@/views/Mine/AddressList.vue'),
        meta: { hideFooter: true }
    },
    //新增地址 路由
    {
        path: routerURL.MY_EDIT_ADDRESS,
        name: 'Editaddress',
        component: () => import('@/views/Mine/EditAddress.vue'),
        meta: { hideFooter: true }
    },
    //我的主页 路由
    {
        path: routerURL.MYPAGE,
        name: 'Mypage',
        component: () => import('@/views/Mine/MypageView.vue'),
        meta: { hideFooter: true }
    },
    //编辑信息 路由
    {
        path: routerURL.MYINFO,
        name: 'MyInfo',
        component: () => import('@/views/Mine/MineInfo.vue'),
        meta: { hideFooter: true }
    },
    //修改密码 路由
    {
        path: routerURL.CHANGEPWD,
        name: 'ChangePwd',
        component: () => import('@/views/Mine/ChangePwd.vue'),
        meta: { hideFooter: true }
    },
    // 消息 路由
    {
        path: routerURL.MESSAGE,
        name: 'Message',
        component: () => import('@/views/Message/MessageView.vue'),
    },
    //聊天页面 路由
    {
        path: routerURL.CHATPAGE,
        name: 'ChatPage',
        component: () => import('@/views/Message/ChatPage.vue'),
        meta: { hideFooter: true }
    },

    // 广场 路由
    {
        path: routerURL.SQUARE,
        name: 'Square',
        component: () => import('@/views/Square/SquareView.vue'),
    },
    //发布动态 路由
    {
        path: routerURL.RELEASE_DYNAMIC,
        name: 'ReleaseDynamic',
        component: () => import('@/views/Square/ReleaseDynamic.vue'),
        meta: { hideFooter: true }
    },

    // 发布商品 路由
    {
        path: routerURL.RELEASEGOODS,
        name: 'ReleaseGoods',
        component: () => import('@/views/ReleaseGoods/ReleaseGoods.vue'),
    },

    // 登录注册 路由
    {
        path: routerURL.LOGIN,
        name: 'Login',
        component: () => import('@/views/LoginView.vue'),
        meta: { hideFooter: true }
    },
    {
        path: routerURL.REGISTER,
        name: 'Register',
        component: () => import('@/views/RegisterView.vue'),
        meta: { hideFooter: true }
    }
];

const router = createRouter({
    history: createWebHistory(),
    routes,
});

export default router;
